/*
 * Process.h
 *
 *  Created on: Jul 11, 2009
 *      Author: elkobir
 */

#ifndef PROCESS_H_
#define PROCESS_H_
#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <vector>
#include <sstream>
#include "Utils.h"
#include "Utils.h"
#include "Log.h"
#include <utility>
#include <math.h>
#include "UnboundedBlockingQueue.h"
using namespace std;

#define EMPTY_INDEX -9;

class Process {
private:
	string _currPath;
	int _pid;
	vector<int> _fdTable;
	UnboundedBlockingQueue* _commList;

	int addFileDescriptor(int fd);
	int removeFileDescriptor(int fd);
	int findIndexOfFileDescriptor(int fd);
	int findIndexOfFirstEmptySpace();


	void processCommand();

public:
	Process(int id);
	Process(int id, string currPath);
	Process(int id, Process father);
	virtual ~Process();

	void sendMessage(string msg);

	string getFullPathName(string path);
	void setpath(string path);
};

#endif /* PROCESS_H_ */
